package com.wm.blog_admin.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wm.blog_admin.domain.RecommendDo;
import com.wm.blog_admin.mapper.TRecommendMapper;
import com.wm.blog_admin.query.TRecommendQuery;
import com.wm.blog_common.base.BaseDAO;
import com.wm.blog_common.bean.QueryPage;
import com.wm.blog_common.entity.TRecommend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * <p>
 * 推荐 服务DAO层
 * </p>
 *
 * @author wm_yu
 * @since 2020-04-15
 */
@Repository
public class TRecommendDAO extends BaseDAO<TRecommendMapper, TRecommend> {

    @Autowired
    private TRecommendMapper tRecommendMapper;

    /**
     * 查询
     * @return
     */
    public int maxOrderNum(Long adminId) {
        return  tRecommendMapper.maxOrderNum(adminId);
    }

    /**
     * 推荐分页查询
     * @param page
     * @param query
     * @return
     */
    public Page<RecommendDo> recommendPage(QueryPage page, TRecommendQuery query) {
        return tRecommendMapper.recommendPage(page,query);
    }

    public RecommendDo recommendMaxMinOrder(TRecommendQuery query) {
        return tRecommendMapper.recommendMaxMinOrder(query);
    }
}

